<template>
	<div class='constbox'>
		<div class="pageContentBox">
			<div class="content-head">
				<div>
					<a-cascader class="condition select" style="width: 150px;" :options="keys" placeholder="姓名"
						v-model="keysVal" />
					<a-input class="condition-input" style="width: 200px;" placeholder="请输入" v-model="keyword" />
					<span class="head-span"> 日期：</span>
					<a-range-picker :locale="locale" v-model="dateValue" @change="onDateChange"
						style="width: 250px; margin-right: 16px" />
					<span class="head-span">审核状态：</span>
					<a-cascader class="condition select" style="width: 150px;" :options="isAdmition" placeholder="全部"
						v-model="isAdmitionVal" />

					<a-button type="primary" icon="search" style="margin-left: 10px;" @click="search">
						<span class="flex_box">
							搜索
						</span>
					</a-button>

					<a-button type="danger" style="margin-left: 10px;" @click="empty">
						<span class="flex_box">
							清空
						</span>
					</a-button>

				</div>
			</div>

			<div class="content-head">
				<div>
					<!-- 					<a-button type="primary"  icon="reload" icon="check-circle">
						<span class="flex_box">
							
							批量导出
						</span>
					</a-button> -->

					<a-button type="primary" icon="plus" style="margin-right:10px;" @click='doBatchExamineFn'>
						<span class="flex_box">
							批量审核
						</span>
					</a-button>


					<a-modal v-model="visibleReport" title="提示" @ok="handleOkReport" :width="478">
						<div class="report-text">确认要批量审核吗?</div>
						<template slot="footer">
							<a-button key="back" @click="handleOkReport" class="btn"> 确定 </a-button>
							<a-button key="submit" type="primary" @click="closeReport" class="btn-cancle"> 取消
							</a-button>
						</template>
					</a-modal>

					<a-button type="primary" v-if="importOrdaoru" style="margin-right:10px;" @click="showUpload">
						教育局信息导入
					</a-button>

					<a-button v-if="importOrExport" type="primary" @click="doExportFn" style="margin-right: 20px;">
						导出未审核并且未导出学生数据
					</a-button>

					<a-button v-if="importOrExport" type="primary" @click="isShowImport = !isShowImport"
						style="margin-right: 20px;">
						审核信息导入
					</a-button>

					<!-- 导入 弹窗 -->
					<a-modal v-model="upload" title="导入" @ok="uploadCancel" @cancel="uploadCancel" :width="1073">
						<table class="import-tr">
							<tr>
								<td class="left-td">
									文件要求
								</td>
								<td class="right-td">
									<div class="pad-style">导入excel文件一定要严格按照规定的格式，注意有选择的数据内容 允许类型：<br>
										"xls和xlsx"(文件总大小不能超过20MB)</div>
								</td>
							</tr>
							<!-- style="margin-left: 10px; margin-top: 5px; margin-buttom: 5px;" -->
							<tr>
								<td class="left-td">选择导入文件</td>
								<td class="right-td">
									<a-upload class="pad-style" name="file" :scroll="{ x: 1500, y: 300 }"
										:showUploadList="false" :multiple="false" :headers="tokenHeader"
										:action="importExcelUrl" @change="ImportExcel">
										<a-button type="primary">
											选择文件
										</a-button>
									</a-upload>
								</td>
							</tr>
							<tr>
								<td class="left-td">导入模版</td>
								<td class="right-td">
									<font class="orange-font pad-style">导入文件请务必使用导入时专有数据模版</font>
									<a class="text-btn-color1" style="font-size: 18px; margin-left: 5px"
										@click="exportModel()">点击下载</a>
								</td>
							</tr>

						</table><br>
						<div class="pointout-apply-div">
							<br />
							<div class="font-apply-div">
								温馨提示：<br />
								①姓名和身份证号必须唯一，身份证号如果已经存在则更新，不存在则新增; <br />
								②导入时默认录取状态字段值为未录取，已报到的不能更新; <br />
								③*专业部名称、专业名称、学制、层次、户口所在省市和县区，必须参照系统中的设置，否则将直接导致导入失败; <br />
								④层次、户口类别、健康状况、政治面貌必须参照数据字典数据，否则导入无效。<br />
								<br>
							</div>
						</div>
					</a-modal>

					<a-button type="primary" icon="reload" @click="search">
						<span class="flex_box">

							刷新
						</span>
					</a-button>

					<!-- 					<a-button type="primary"  icon="reload" icon="check-circle" @click='batchPass'>
						<span class="flex_box">
							
							通过
						</span>
					</a-button>
					
					<a-button type="primary" icon="stop"  style="margin-right:10px;" @click='batchNoPass'>
						<span class="flex_box">
							
							不通过
						</span>
					</a-button> -->
				</div>
			</div>
			<div>

				<a-table :columns="columns" :scroll="{ x: 1500 }" :data-source="data" :row-selection="rowSelection"
					:defaultCurrent="6" :pagination="pagination" @change="tableChange">
					<div slot="check" slot-scope="text, record">
						<a v-if="record.isAdmit === '未审核'" class="text-btn-color2"
							@click="doSingleCheck(record.key, 1)">通过</a>
						<a-divider v-if="record.isAdmit === '未审核'" type="vertical"></a-divider>
						<a v-if="record.isAdmit === '未审核'" class="text-btn-color2"
							@click="doSingleCheck(record.key, 2)">驳回</a>
						<a v-else class="text-btn-color2">{{ record.isAdmit }}</a>

					</div>
					<div slot="operator" slot-scope="text, record">
						<a class="text-btn-color2" @click="showMsg(record)">查看</a>
					</div>

				</a-table>
			</div>
		</div>

		<!-- start -->
		<a-modal v-model="visible" title="查看招生信息" on-ok="handleClose" :width="1073">
			<!-- 不打印区域 -->

			<template slot="footer">
				<a-button key="back" v-print="'#printContent'" class="btn"> 打印 </a-button>
				<a-button key="submit" type="primary" :loading="loading" @click="handleClose" class="btn-cancle">
					关闭
				</a-button>
			</template>
			<div ref="print" id="printContent">
				<table class="scanTable" style="text-align: left">
					<tr>
						<td colspan="4" class="tr-color">
							<span class="title-style">基本信息</span>
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">姓名</div>
						</td>
						<td class="double">
							{{ entityObj.xm }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.xm"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">身份证号</div>
						</td>
						<td class="double">
							{{ entityObj.sfzh }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.sfzh"></a-input> -->
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">性别</div>
						</td>
						<td class="double">
							{{ entityObjTwo.XBM }}
							<!-- <a-input read-only class="input-style" v-model="entityObjTwo.XBM"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">学生手机</div>
						</td>
						<td class="double">
							{{ entityObj.xslxdh }}
							<!-- <a-input read-only class="input-style" v-model="entityObjTwo.xslxdh"></a-input> -->
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">毕业学校</div>
						</td>
						<td class="double">
							{{ entityObj.byxx }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.byxx"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">毕业学校地址</div>
						</td>
						<td class="double">
							{{ entityObj.middleSchoolProvince + entityObj.middleSchoolCity +
								entityObj.middleSchoolCounty }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.middleSchoolProvince+entityObj.middleSchoolCity+entityObj.middleSchoolCounty"></a-input> -->
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">专业</div>
						</td>
						<td class="double">
							{{ entityObjTwo.ZYMC }}
							<!-- <a-input read-only class="input-style" v-model="entityObjTwo.ZYMC"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">中考总分</div>
						</td>
						<td class="double">
							{{ entityObj.kszf }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.kszf"></a-input> -->
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">家长姓名</div>
						</td>
						<td class="double">
							{{ entityObj.jzxm }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.jzxm"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">家长电话</div>
						</td>
						<td class="double">
							{{ entityObj.jtlxdh }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.jtlxdh"></a-input> -->
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">身高(cm)</div>
						</td>
						<td class="double">
							{{ entityObj.height }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.height"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">体重(kg)</div>
						</td>
						<td class="double">
							{{ entityObj.weight }}
							<!-- <a-input read-only class="input-style" v-model="entityObj.weight"></a-input> -->
						</td>
					</tr>

					<tr class="tr-style">
						<td class="td-div">
							<div class="font-style">联系地址</div>
						</td>
						<td class="double">
							{{ entityObjTwo.jtdz }}
							<!-- <a-input read-only class="input-style" v-model="entityObjTwo.jtdz"></a-input> -->
						</td>
						<td class="td-div">
							<div class="font-style">推荐人</div>
						</td>
						<td class="double">
							{{ entityObjTwo.refereeRealName }}
							<!-- <a-input read-only class="input-style" v-model="entityObjTwo.refereeRealName"></a-input> -->
						</td>
					</tr>
				</table>

			</div>
		</a-modal>
		<!-- end -->

		<!-- end -->
		<edu-form title="数据导入" v-if="isShowImport" width="40%" top="200px" @ok="doImportFn(false)"
			@cancel="doImportFn()">
			<div>
				<a-form-model labelAlign="right">
					<a-form-model-item label="附件">
						<uploadFilesQuery :showFiles="false" one :url="importUrl" v-if="doImport" :getParams="doImport"
							serviceType="upload" :showMsg="false" @upload="doImportFn" uploadBtnClass="success"
							uploadBtnName="选择文件" style="display: inline-block;" />
					</a-form-model-item>
				</a-form-model>
			</div>
		</edu-form>

		<a-modal v-model="visibleCheck" title="批量审批" on-close="cancel" :width="500">
			<template>
				<!-- 底部按钮 -->
				<template>
					<a-button key="back" @click="doCheckOk" class="btn"> 通过 </a-button>
					<a-button key="submit" @click="doCheckNo" danger> 驳回 </a-button>
				</template>
			</template>
		</a-modal>


		<!-- 教育局导入出现问题展示 -->
		<a-modal v-model="visibleImportError" title="重复信息" @ok="uploadCancelError" @cancel="uploadCancelError"
			:width="1073">
			<div class="pointout-apply-div">
				<br />
				<div class="font-apply-div">
					<div v-for="(item, index) in duplicateMsg">{{ item }}</div>
					<br>
				</div>
			</div>
			<table class="import-tr">
				<tr>
					<td class="left-td">重复数据文件</td>
					<td class="right-td">
						<a class="text-btn-color1" style="font-size: 18px; margin-left: 5px"
							@click="errorFile()">点击下载</a>
					</td>
				</tr>

			</table><br>

		</a-modal>

	</div>
</template>


<script>
import { ref } from 'vue';

import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';

import uploadFilesQuery from '@/components/kqManageComponent/uploadFiles.vue';

import {
	EduListMixin
} from '@/mixins/EduListMixin'
import {
	Icon
} from 'ant-design-vue'

import {
	axios
} from '@/utils/request'
import {
	filterIds
} from '@/utils/util'
import { create } from 'js-md5';

const IconFont = Icon.createFromIconfontCN({
	scriptUrl: '//at.alicdn.com/t/font_2390461_f6v2cx4wmzq.js',
})


const columns = [
	{
		title: '审核',
		dataIndex: 'check',
		fixed: 'left',
		width: 130,
		key: 'check',
		scopedSlots: {
			customRender: 'check',
		},
	},
	{
		title: '姓名',
		dataIndex: 'XM',
		key: 'XM',
		fixed: 'left',
		width: 150,
	},
	{
		title: '报名时间',
		dataIndex: 'createTime',
		key: 'createTime',
		fixed: 'left',
		width: 150,
	},
	{
		title: '推荐人',
		dataIndex: 'refereeRealName',
		key: 'refereeRealName',
		fixed: 'left',
		width: 150,
	},
	{
		title: '身份证号',
		dataIndex: 'SFZH',
		key: 'SFZH',
		width: 200,
		customRender: function (text) {
			return filterIds(text)
		}
	},
	{
		title: '性别',
		dataIndex: 'XBM',
		key: 'XBM',
		width: 90,
	},
	{
		title: '拟报我校专业',
		dataIndex: 'ZYMC',
		key: 'ZYMC',
	},
	{
		title: '中考总分',
		dataIndex: 'KSZF',
		key: 'KSZF',
	},
	{
		title: '审核状态',
		dataIndex: 'isAdmit',
		key: 'isAdmit',
	},
	{
		title: '操作',
		dataIndex: 'operator',
		fixed: 'right',
		width: 100,
		key: 'operator',
		scopedSlots: {
			customRender: 'operator',
		},
	},

]

let data = []


export default {
	mixins: [EduListMixin],
	data() {
		return {
			locale,
			visibleImportError: false,
			checkResult: '',
			visibleCheck: false,
			importUrl: 'enroll/ApplyCheck/importCheck',
			isShowImport: false,
			pagination: {
				current: 0,
				pageSize: 10,
				showSizeChanger: true,
				pageSizeOptions: ['6', '10', '20'],
				showTotal: (total, range) => {
					return '显示' + range[0] + '到' + range[1] + '条, 共' + total + '条记录'
				},
				showQuickJumper: true,
				total: 0,
			},
			//选中放入的数组
			selectedRowKeys: [],
			/* 页码 */
			currentPage: 1,
			pageSize: 10,

			/* 表格数据 */
			data,
			columns,
			/* 按钮大小 */
			size: 'small',
			/* 下拉框数据 */
			quarter: [],
			quarterId: [],
			faculty: [],
			facultyId: [],
			specialty: [],
			specialtyId: [],
			keys: [],
			keysVal: [],
			//是否被审核
			isAdmition: [],
			isAdmitionVal: [],
			/* 按条件搜索报到的数量 */
			reportCount: 0,
			/* 添加-弹出框数据 */
			visibleReport: false,
			visibleReportBySearch: false,
			visibleDelete: false,
			visible: false,
			loading: false,
			entityObj: {}, //弹窗对象
			entityObjTwo: {}, //弹窗对象二
			//搜索条件
			curQuarter: 0,
			curFaculty: 0,
			curSpecialty: 0,
			condit: '',
			isCheck: -1,
			/* 关键词 */
			keyword: '',
			url: {
				list: 'enroll/ApplyMsgMng/exportModel',
				exportXlsUrl: 'enroll/ApplyMsgMng/exportTable',
				importExcelUrl: 'enroll/ApplyMsgMng/importExmlByFile',
			},
			upload: false,
			exportConfig: {
				url: '/enroll/ApplyCheck/exportCheck',
				name: '《审核信息表导出》'
			},
			duplicateConfig: {
				url: '/enroll/ApplyMsgMng/exportDuplicate',
				name: '《重复信息表导出》'
			},
			importOrExport: false,
			importOrdaoru:false,
			queryParam: {
				beginDate: '',
				endDate: '',
				userid: '',
				pageNo: 1,
				pageSize: 10
			},
			duplicateMsg: [],
			duplicateSFZH: "",
			dateValue: []

		}
	},
	created(){
		return {
        locale,
        value: null,
      };
	},
	mounted() {
		this.getStuList()
		this.getQuarter()
		this.getFaculty()
		this.addCondit()
		this.isAdmitQuery()
		this.getRole()
	},
	//关于全选与批量
	computed: {
		// 拼接导入
		importExcelUrl: function () {
			return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
		},
		rowSelection() {
			const selectedRowKeys = this.selectedRowKeys //常量
			console.log('selectedRowKeys:', selectedRowKeys, this.selectedRowKeys)
			return {
				selectedRowKeys,
				onChange: this.onSelectChange,
			}
		},
	},
	components: {
		IconFont,
		uploadFilesQuery
	},
	methods: {
		/* 导入 */
		ImportExcel(info) {
			if (info.file.status !== 'uploading') {
				console.log(info.file, info.fileList);
			}
			if (info.file.status === 'done') {
				if (info.file.response.success) {
					console.log("info", info)
					if (info.file.response.result.duplicateList.length > 0) {
						this.duplicateMsg = info.file.response.result.errorMessageList.split(";")
						this.duplicateSFZH = info.file.response.result.duplicateList
						this.visibleImportError = true
						console.log("msg", this.duplicateMsg)
					}
					// this.$message.success(`${info.file.name} 文件上传成功`);
					if (info.file.response.code === 201) {
						let { message, result: { msg, fileUrl, fileName } } = info.file.response
						let href = window._CONFIG['domianURL'] + fileUrl
						this.$warning({
							title: message,
							content: (
								<div>
									<span>{msg}</span><br />
									<span>具体详情请 <a href={href} target="_blank" download={fileName}>点击下载</a> </span>
								</div>
							)
						})
					} else {
						this.$message.success(info.file.response.message || `${info.file.name} 文件上传成功`)
					}
					this.loadData()
				} else {
					this.$message.error(`${info.file.name} ${info.file.response.message}.`);
				}
			} else if (info.file.status === 'error') {
				if (info.file.response.status === 500) {
					let data = info.file.response
					const token = Vue.ls.get(ACCESS_TOKEN)
					if (token && data.message.includes("Token失效")) {
						Modal.error({
							title: '登录已过期',
							content: '很抱歉，登录已过期，请重新登录',
							okText: '重新登录',
							mask: false,
							onOk: () => {
								store.dispatch('user/Logout').then(() => {
									Vue.ls.remove(ACCESS_TOKEN)
									window.location.reload();
								})
							}
						})
					}
				} else {
					this.$message.error(`文件上传失败: ${info.file.msg} `);
				}
			}
		},
		doSingleCheck(recode, result) {
			this.checkResult = result;
			this.singleExamine(recode);
		},
		doCheckOk() {
			this.checkResult = 1;
			this.batchExamine();
		},
		doCheckNo() {
			this.checkResult = 2;
			this.batchExamine();

		},
		completeTimeParams(params) {
			return {
				start: params.beginDate.length === 10 ? params.beginDate + ' 00:00:00' : params.beginDate,
				end: params.endDate.length === 10 ? params.endDate + ' 23:59:59' : params.endDate
			};
		},
		onDateChange(dates, dateStrings) {
			this.queryParam.beginDate = dateStrings[0];
			this.queryParam.endDate = dateStrings[1];
		},
		//从storage中获取角色
		getRole() {
			const roles = JSON.parse(window.localStorage.getItem("role"))
			console.log("roles", roles)
			roles.forEach(item => {
				if(item != 'zjktest'){
					this.importOrdaoru = true
					return;
				}
			})
			roles.forEach(item => {
				console.log("importOrExport", this.importOrExport)
				if (item == "system" || item == "zjkzr") {
					this.importOrExport = true
					return;
				}
			})
		},
		doImport() {
			return {
				temp: [
					'班级代码',
					'班级名称',
					'所属年级代码',
					'所属年级',
					'专业代码',
					'专业名称',
					'毕业时间',
					'建班年月',
					'所属班主任',
					'班长',
					'固定教室名称',
					'班级位置',
					'班级上限人数'
				],
				tempName: '班级基本信息',
				implName: 'VeBaseBanJiServiceImpl.importExcel',
			}
		},
		doImportFn(type) {
			this.isShowImport = false;
			if (!type) {
				return;
			}
			this.$message.success('导入成功');
			this.getStuList();
		},
		doExportFnReal() {
			const config = {
				service: 'common',
				name: '导出',
				nameTime: true
			};
			Object.assign(config, this.exportConfig);
			if (!config.url) {
				return;
			}
			if (config.nameTime) {
				config.name += this.$date.format() + '.xlsx';
			}
			//数据加载
			// let reqData = {};
			// reqData[this.sizeName] = 100000;
			// reqData[this.idList] = []
			// /* 如果是自己的 */
			// reqData[this.sizeName] = 100000;
			// reqData[this.pageName] = 1;
			// if (this.params) {
			//   Object.assign(reqData, this.params);
			// }
			// if (this.getParams) {
			//   Object.assign(reqData, this.getParams());
			// }
			// reqData.sorts = {
			//   column: 'd.id',
			//   asc: false
			// };

			this.$http.exportExcel(config.url, this.selectedRowKeys, 'post', {
				name: config.name,
			})

		},

		doExportFn() {
			let _this = this;
			this.$confirm({
				title: '提示',
				content: '确定要导出' + _this.exportConfig.name + '吗?',
				okText: '确认',
				cancelText: '取消',
				onOk() {
					_this.doExportFnReal();
				},
				onCancel() { },
			});
		},
		//导出模板
		exportModel() {
			this.url.exportXlsUrl = 'enroll/ApplyMsgMng/exportModel';
			this.handleExportXls('报名信息导入模板');
			this.url.exportXlsUrl = 'enroll/ApplyMsgMng/exportTable';
		},
		//数据重复数据文件下载
		errorFile() {
			this.url.exportXlsUrl = 'enroll/ApplyMsgMng/exportDuplicate?sfzhList=' + this.duplicateSFZH;
			this.handleExportXls('重复数据导出文件');
			this.url.exportXlsUrl = 'enroll/ApplyMsgMng/exportTable';
		},
		//关闭重复数据导出弹窗
		uploadCancelError() {
			this.visibleImportError = false
		},
		//关闭导入弹窗
		uploadCancel() {
			this.upload = false
		},
		// end
		//显示导入弹窗
		showUpload() {
			this.upload = true
		},
		doBatchExamineFn() {
			let _this = this;
			this.visibleCheck = true;
			// this.$confirm({
			// 	title: '提示',
			// 	content: '是否审批通过?',
			// 	okText: '确认',
			// 	cancelText: '取消',
			// 	onOk() {
			// 		_this.batchExamine();
			// 	},
			// 	onCancel() { },
			// });
		},
		// 批量审核接口
		batchExamine() {
			var ids = ''

			for (var i = 0; i < this.selectedRowKeys.length; i++) {
				console.log(this.selectedRowKeys[i])
				if (i == 0) {
					ids += this.selectedRowKeys[i]
				} else {
					ids += ',' + this.selectedRowKeys[i]
				}
			}
			axios({
				url: '/enroll/ApplyCheck/batchCheck',
				method: 'post',
				params: {
					ids: ids,
					checkResult: this.checkResult
				},
			}).then((res) => {
				if (res.code == '200') {
					this.$message.success(res.result)
					this.selectedRowKeys = []
					this.visibleCheck = false
					this.getStuList()
				} else {
					this.$message.warning('批量审核失败')
				}
			})
		},
		doExamineFn(recode) {
			let _this = this;
			this.$confirm({
				title: '提示',
				content: '是否审批通过?',
				okText: '确认',
				cancelText: '取消',
				onOk() {
					_this.singleExamine(recode);
				},
				onCancel() { },
			});
		},
		singleExamine(recode) {
			console.log("recode", recode)
			axios({
				url: '/enroll/ApplyCheck/batchCheck',
				method: 'post',
				params: {
					ids: recode,
					checkResult: this.checkResult
				},
			}).then((res) => {
				if (res.code == '200') {
					this.$message.success(res.result)
					this.selectedRowKeys = []
					this.getStuList()
				} else {
					this.$message.warning('审核失败')
				}
			})
		},
		batchPass() {
			var ids = ''
			for (var i = 0; i < this.selectedRowKeys.length; i++) {
				console.log(this.selectedRowKeys[i])
				if (i == 0) {
					ids += this.selectedRowKeys[i]
				} else {
					ids += ',' + this.selectedRowKeys[i]
				}
			}
			axios({
				url: '/enroll/ApplyCheck/batchPass',
				method: 'post',
				params: {
					ids: ids
				},
			}).then((res) => {
				if (res.code == '200') {
					this.$message.success(res.result)
					this.selectedRowKeys = []
					this.getStuList()
				} else {
					this.$message.warning('批量通过失败')
				}
			})
		},
		batchNoPass() {
			var ids = ''
			for (var i = 0; i < this.selectedRowKeys.length; i++) {
				console.log(this.selectedRowKeys[i])
				if (i == 0) {
					ids += this.selectedRowKeys[i]
				} else {
					ids += ',' + this.selectedRowKeys[i]
				}
			}
			axios({
				url: '/enroll/ApplyCheck/batchNoPass',
				method: 'post',
				params: {
					ids: ids
				},
			}).then((res) => {
				if (res.code == '200') {
					this.$message.success(res.result)
					this.selectedRowKeys = []
					this.getStuList()
				} else {
					this.$message.warning('批量不通过失败')
				}
			})
		},


		cascaderChange(e) {
			if (this.facultyId.length < 1) {
				this.$message.warning('请先选择专业部！')
			}
			console.log(e)
		},
		//start
		showMsg(a) {
			console.log("a", a)
			axios({
				url: 'enroll/reportMng/getInfoByID',
				method: 'post',
				params: {
					id: a.key,
				},
			})
				.then((res) => {
					this.entityObj = res.result
					this.entityObjTwo = a
					//数据加工处理
					let zslx = res.result.zslx == 1 ? '统一招生' : '自主招生'
					let jdfs = res.result.jdfs == 1 ? '住校' : '走读'
					let sfdb = res.result.sfdb == 1 ? '是' : '否'

					this.entityObj.zslx = zslx
					this.entityObj.jdfs = jdfs
					this.entityObj.sfdb = sfdb
					this.entityObj.country
				})
				.catch((err) => {
					this.$message.warning('获取招生信息失败')
				})
			this.visible = true
		},
		handleClose(e) {
			setTimeout(() => {
				this.visible = false
				this.loading = false
			})
		},
		handlePrint(e) {
			this.visible = false
		},
		// end
		onSelectChange(selectedRowKeys) {
			this.selectedRowKeys = selectedRowKeys
			console.log('selectedRowKeys changed: ', selectedRowKeys)
		},
		clear() {
			this.quarterId = []
			this.facultyId = []
			this.specialty = []
			this.specialtyId = []
		},
		empty() {
			this.dateValue = []
			this.keyword = ''
			this.keysVal = []
			this.isAdmitionVal = []
			this.queryParam.beginDate = ''
			this.queryParam.endDate = ''
			this.clear()

		},
		batchCheck() {
			let ids = ''

			for (let i = 0; i < this.selectedRowKeys.length; i++) {
				ids += this.selectedRowKeys[i]
				if (i != this.selectedRowKeys.length - 1) {
					ids += ','
				}
			}

			axios({
				url: 'enroll/ApplyCheck/batchCheck',
				method: 'post',
				params: {
					ids: ids,
				},
			})
				.then((res) => {
					this.$message.success(res.result)
					//清空勾选项
					this.selectedRowKeys = []
					this.getStuList()
				})
				.catch((err) => {
					this.$message.warning('批量审核失败')
				})
		},
		search() {
			this.currentPage = 1
			this.curQuarter = this.quarterId.length == 0 ? 0 : this.quarterId[0]
			this.curFaculty = this.facultyId.length == 0 ? 0 : this.facultyId[0]
			this.curSpecialty = this.specialtyId.length == 0 ? 0 : this.specialtyId[0]
			this.condit = this.keysVal[0] == undefined ? 'XM' : this.keysVal[0]
			this.isCheck = this.isAdmitionVal[0] == undefined ? -1 : this.isAdmitionVal[0]
			this.getStuList()
		},
		refresh() {
			console.log(this.selectedRowKeys)
			this.selectedRowKeys = []
			this.getStuList()
		},
		showModalReport() {
			if (this.selectedRowKeys.length == 0) {
				this.$message.warning('请选择要审核的学生！')
				return;
			}

			this.visibleReport = true
		},
		handleOkReport() {
			this.batchCheck()
			this.visibleReport = false
		},
		closeReport() {
			this.visibleReport = false
		},

		handleOkReportBySearch() {
			this.batchReportBySearch()
			this.visibleReportBySearch = false
		},
		showModalDelete() {
			if (this.selectedRowKeys.length == 0) {
				this.$message.warning('请选择要删除的学生！')
				return
			}

			this.visibleDelete = true
		},
		handleOkDelete() {
			this.deleteStu()
			this.visibleDelete = false
		},

		tableChange(pagination) {
			/* , filters, sorter */
			this.pagination.current = pagination.current
			this.pagination.pageSize = pagination.pageSize
			this.currentPage = pagination.current
			this.pageSize = pagination.pageSize

			this.getStuList()
		},
		getStuList() {
			let currentPage = this.currentPage
			let pageSize = this.pageSize

			const time = this.completeTimeParams(this.queryParam)
			console.log(time)
			axios({
				url: 'enroll/ApplyCheck/applyMsg',
				method: 'post',
				params: {
					quarterId: this.curQuarter,
					facultyId: this.curFaculty,
					specialtyId: this.curSpecialty,
					keyword: this.keyword,
					condit: this.condit,
					currentPage: currentPage,
					pageSize: pageSize,
					isCheck: this.isCheck,
					startTime: time.start,
					endTime: time.end
				},
			})
				.then((res) => {
					if (res.code == 200) {
						data.splice(0, data.length)
						for (let stu of res.result.list) {
							let sex = stu.xbm == 1 ? '男' : '女'
							let isAdmit = stu.isCheck == 1 ? '已通过' :
								stu.isCheck == 0 ? '未审核' :
									stu.isCheck == 2 ? '未通过' :
										stu.isCheck == 3 ? '未通过' : '错误'
							data.push({
								key: stu.id,
								XM: stu.xm,
								createTime: stu.createTime,
								refereeRealName: stu.refereeRealName,
								SFZH: stu.sfzh,
								YXMC: stu.yxmc,
								ZYMC: stu.zymc,
								KSZF: stu.kszf,
								isAdmit: isAdmit,
								XBM: sex,
								RXNF: stu.rxnf,
								ZSJ: stu.zsj,
								XZ: stu.xz,
							})
						}
						this.pagination.current = currentPage
						this.pagination.total = res.result.count
						return
					}
					this.$message.warning(res.message)
				})
				.catch((err) => {
					this.$message.warning('获取学生列表失败')
				})
		},
		isAdmitQuery() {
			for (let k of [{
				value: -1,
				label: '全部'
			},
			{
				value: 1,
				label: '已通过'
			},
			{
				value: 0,
				label: '未审核'
			},
			{
				value: 2,
				label: '未通过'
			}
			]) {
				this.isAdmition.push({
					value: k.value,
					label: k.label,
				})
			}
		},
		addCondit() {
			for (let k of [{
				value: 'XM',
				label: '姓名'
			},
			{
				value: 'SFZH',
				label: '身份证号'
			},
			]) {
				this.keys.push({
					value: k.value,
					label: k.label,
				})
			}
		},

		getQuarter() {
			axios({
				url: 'enroll/reportMng/getQuarter',
				method: 'post',
				params: {},
			})
				.then((res) => {
					for (let quarter of res.result) {
						this.quarter.push({
							value: quarter.id,
							label: quarter.name,
						})
					}
				})
				.catch((err) => {
					this.$message.warning('获取招生季失败')
				})
		},
		getFaculty() {
			axios({
				url: 'enroll/reportMng/getFaculty',
				method: 'post',
				params: {},
			})
				.then((res) => {
					//this.faculty.splice(0, this.faculty.length);
					for (let faculty of res.result) {
						this.faculty.push({
							value: faculty.id,
							label: faculty.yxmc,
						})
					}
				})
				.catch((err) => {
					this.$message.warning('获取专业部失败')
				})
		},
		facultyChange(value) {

			this.specialty = []
			this.specialtyId = []

			if (value.length == 0) {
				return
			}

			axios({
				url: 'enroll/reportMng/getSpecialty',
				method: 'post',
				params: {
					facultyId: this.facultyId[0],
				},
			})
				.then((res) => {
					this.specialty.splice(0, this.specialty.length)
					for (let specialty of res.result) {
						this.specialty.push({
							value: specialty.id,
							label: specialty.zymc,
						})
					}
				})
				.catch((err) => {
					this.$message.warning('获取专业失败')
				})
		},
	},
}
</script>
<style>
.icon_btn {
	color: #ffffff;
	font-size: 16px;
	margin-right: 20px;
	width: 88px;
	height: 34px;
}

.icon_btn_type_2 {
	color: #ffffff;
	font-size: 16px;
	margin-right: 20px;
	height: 34px;
}

.import-tr {
	width: 1030px;
}

.left-td {
	background-color: #f5f5f5;
	width: 100px;
	height: 50px;
	border: 1px solid #e5e5e5;
	font-size: 18px;
	font-family: Microsoft YaHei;
	font-weight: 700;
	color: #666666;
	line-height: 24px;
}

.right-td {
	border: 1px solid #e5e5e5;
	font-size: 18px;
	font-family: Microsoft YaHei;
	font-weight: 700;
	color: #666666;
	line-height: 24px;
	width: 230px;
	height: 50px;
}

.pad-style {
	margin-left: 10px;
	margin-top: 5px;
	margin-bottom: 5px;
}

.orange-font {
	height: 20px;
	font-size: 18px;
	font-family: Microsoft YaHei;
	font-weight: 700;
	color: #FC8950;
	line-height: 28px;
}

.pointout-apply-div {
	width: 1030px;
	height: 185px;
	background-color: #dee2e6;
}

.font-apply-div {
	width: 1030px;
	height: 29px;
	font-size: 18px;
	font-family: Microsoft YaHei;
	font-weight: 700;
	color: #3581a6;
	line-height: 28px;
	margin-left: 15px;
}

.choose-file-btn {
	width: 124px;
	height: 34px;
	color: white;
	background: #00BAD0;
	border-radius: 5px;
}

.choose-file-btn,
.choose-file-btn:hover,
.choose-file-btn:active,
.choose-file-btn:focus {
	color: white;
	background-color: #00bad0;
}

.tb {
	text-align: left;
}

/* 标题样式 */
.title-style {
	width: 76px;
	height: 19px;
	font-size: 18px;
	font-family: Microsoft YaHei;
	font-weight: 700;
	margin-left: 23px;
	color: #ffffff;
	line-height: 24px;
}

/* 字体样式1 */
/* .font-style {
  margin-left: 21px;
  width: 123px;
  height: 18px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  font-weight: 700;
  color: #666666;
  line-height: 24px;


} */
/* 
.input-style-reply {
  font-size: 18px;
  color: #666666;
  width: 300px;
  background-color: #ffffff;
  border: 0;
  margin-left: 5px;
}
.input-style-replyTwo {
  font-size: 18px;
  color: #666666;
  width: 200px;
  background-color: #ffffff;
  border: 0;
  margin-left: 5px;
} */
/* 
.td-div {
  width: 259px;
} */

/* .btn {
  width: 100px;
  height: 40px;
  background: #0098f8;
  border-radius: 5px;
  font-size: 18px;
  font-family: Microsoft YaHei;
  color: #ffffff;
} */

/* .btn-div {
  width: 100%;
} */

.btn-style {
	width: 100px;
	height: 40px;
	margin-bottom: 33px;
	margin-top: 30px;
}

.top-div {
	margin-top: 22px;
}

/* .ant-input {
  width: 300px;
  height: 40px;
} */

.r-style {
	font-size: 18px;
}

.icon-img {
	margin-bottom: 5px;
	margin-right: 1px;
}

.notNull-tip {
	height: 19px;
	font-size: 18px;
	font-family: Microsoft YaHei;
	font-weight: 700;
	color: #a83939;
	line-height: 24px;
}

.applyexport-button {
	width: 88px;
	height: 34px;
	background: #00D09D;
	border-radius: 5px;
	margin-left: 10px;
}

.applyexport-button,
.applyexport-button:hover,
.applyexport-button:active,
.applyexport-button:focus {
	color: white;
	background-color: #00D09D;
}

.applyMngAdd-button {
	width: 88px;
	height: 34px;
	background: #00bad0;
	border-radius: 5px;
}

.applyMngAdd-button,
.applyMngAdd-button:hover,
.applyMngAdd-button:active,
.applyMngAdd-button:focus {
	color: white;
	background-color: #00bad0;
}
</style>